num=6
numSum=2+3+5
while num<2000000:
    for i in range(2, int(num**0.5+1)):
        if num%i==0:
            break
    else:
        numSum+=num
    num+=1
print numSum
